package com.dennytech.tac.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.ImageView;

public class BorderImageView extends ImageView {
	private int co = 0xffffffff;
	private int borderwidth = 4;

	public BorderImageView(Context context) {
		super(context);
	}

	public BorderImageView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	public BorderImageView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public void setColour(int color) {
		co = color;
	}

	public void setBorderWidth(int width) {
		borderwidth = width;
	}

	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		Rect rec = canvas.getClipBounds();
		Paint paint = new Paint();
		paint.setColor(co);
		paint.setStyle(Paint.Style.STROKE);
		paint.setStrokeWidth(borderwidth);
		canvas.drawRect(rec, paint);
	}
}
